import FileSaver from 'file-saver';
import * as XLSX from 'xlsx';


export function exportXlsx(id){
    const wb = XLSX.utils.table_to_book(document.getElementById(id));
    const wbout = XLSX.write(wb,{
        bookType:'xlsx',
        bookSST:true,
        type:'array'
    })
    try{
        FileSaver.saveAs(new Blob([wbout],{
            type:'application/octet-stream'
        }),'download.xlsx')
    }
    catch(e){
        if(typeof console !== 'undefined'){
            console.log(e,wbout);
        }
    }
    return wbout;
}